Package-level declarations
Extensions of built-in types (e.g. Either
, Option
, etc)
Functions
Turns your Validated List into an Either, but will throw an exception in the Left hand case.
The Validated type doesn't natively support flatMap because of the monad laws that it breaks. But this is what flatMap would do if it were allowed. We've called it concatMap because the Kotlin compiler will want to wire in the Monad flatMap extension instead and confusion reigns.
Performs an effect over the right side of the value but maps the original value back into the Either. This is useful for mixing with validation functions.
Performs an effect over successes but maps the original value back into the Result. This is useful for mixing with validation functions.
An extension method for constructing an invalid ValidatedNel.
Constructs a flattened list without Nones
Applies a function that produces an Option to a NonEmptyList. The result is None if the resulting list would be empty, otherwise Some(NonEmptyList).
Returns a list containing only the non-None results of applying the given transform function to each element in the original collection.
Returns the first successful either, otherwise the last failure
Returns this
if it's a Some, otherwise returns the other
instance
Retrieves the Right hand of an Either, or throws the Left hand error
Retrieves the success of a Result, or throws the failure. Alias of getOrThrow
, included for consistency with ErrorOr.
Often you have two validations that return the same thing, and you don't want necessarily to pair them. takeLeft will return the value of the left side iff both validations succeed.
Often you have two validations that return the same thing, and you don't want necessarily to pair them. takeRight will return the value of the right side iff both validations succeed.
Turns your Option into a Validated list of T if it's a Some. If it's a None, will return a Nel of the error function passed in
Map a function that returns an Either across the NonEmptyList.
Map a function that returns an Option across the NonEmptyList.
Map a function that returns an Either across the Option.
Map a function that returns an Iterable across the Option.
Returns an Either of a list of B results of applying the given transform function to each element(A) in the original collection.
Returns an Option of a list of B results of applying the given transform function to each element(A) in the original collection.
Returns a Result of a list of B results of applying the given transform function to each element(A) in the original collection.
Map a function that returns an Either over all the values in the Map. If the function returns a Right, the value is added to the resulting Map. If the function returns a Left, the result is the Left.
Map a function that returns an Option over all the values in the Map. If the function returns a Some, the value is added to the resulting Map. If the function returns a None, the result is None.
Map a function that returns an Either across the Sequence.
Map a function that returns an Option across the Sequence.
Synonym for traverse((A)-> Option): Option
Synonym for traverse((A)-> Option): Option
Synonym for traverse((A)-> Option): Option>
Synonym for traverse((A)-> Option): Option
Map right to Unit. This restores .void()
which was deprecated by Arrow.
Map some to Unit. This restores .void()
which was deprecated by Arrow.
Map success to Unit, included for consistency with Either.
Given a mapping function and an error message, return either the result of the function in a ValidNel if the function completes successfully, or the error message in an InvalidNel.
Retry a suspended supplier of an ErrorOr until a maximum number of times or a predicate has been fulfilled.
Retry a suspended supplier until a maximum number of times or a predicate has been fulfilled.